package com.hadoop.turingroledistinguish.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

@RestController
@RequestMapping("/flamefind")
public class TuringFlameFindController {
     @RequestMapping("/flamedist")
     public void roleDistinguish(){
         Process proc;
         try {
             proc = Runtime.getRuntime().exec("python ./src/main/python/fire-detect05.py");
             BufferedReader in = new BufferedReader(new InputStreamReader(proc.getInputStream()));
             String line = null;
             while ((line = in.readLine()) != null) {
                 //读取的内容 返回的什么结果 -->着火了-->危险的信号
                 //读取的结果 ------>
                 System.out.println(line);
             }
             in.close();
             proc.waitFor();
         } catch (IOException e) {
             e.printStackTrace();
         } catch (InterruptedException e) {
             e.printStackTrace();
         }
     }
}
